﻿
operate_area =
{
    menu_item_status = {
       exit_game = false,
       multi_zone = false,
       multi_account = false,
       cloud_game = false,
       server_info = false,
    };

    menu_state_btn_background_ = {};
    nomenu_state_btn_background_ = {};

    menu_entry_bg = {
        kNormalYello = "ONEIMAGE:bottom_bar\\more_normal.png;Stretch;0;",
        kHoverYello = "ONEIMAGE:bottom_bar\\more_hover.png;Stretch;0;",

        kNormalBlue = "ONEIMAGE:bottom_bar\\more_normal_blue.png;Stretch;0;",
        kHoverBlue = "ONEIMAGE:bottom_bar\\more_hover_blue.png;Stretch;0;",

        kNormalGreen = "ONEIMAGE:bottom_bar\\more_normal_green.png;Stretch;0;",
        kHoverGreen = "ONEIMAGE:bottom_bar\\more_hover_green.png;Stretch;0;",
    };

    inner_log = function (msg, core_msg)
        base_utility.log(string.format("[operate_area] %s", msg), core_msg);
    end;

    init = function()
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_NORMAL] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\start.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\start_hover.png;Stretch;0",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_NEED_UPDATE] = {
           background = "ONEIMAGE:bottom_bar\\with_menu\\update_normal.png;Stretch;0;",
           background_hover = "ONEIMAGE:bottom_bar\\with_menu\\update_hover.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_UPDATE_FAIL] = {
           background = "ONEIMAGE:bottom_bar\\with_menu\\re_update_normal.png;Stretch;0;",
           background_hover = "ONEIMAGE:bottom_bar\\with_menu\\re_update_hover.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\download_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\download_hover.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_DOWNLOADED] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\install_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\install_hover.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_DOWNLOAD_FAIL] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\re_download_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\re_download_hover.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_BROKEN] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\re_download_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\re_download_hover.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_LAUNCHING] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\starting.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\starting.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_RUNNING] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\running.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\running.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[
                                          ierd_tgp.game_library.GAME_STATE_SERVER_UNAVAILABLE] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\mainting.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\mainting.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_UNINSTALLING] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\uninstalling.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\uninstalling.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[
                                            ierd_tgp.game_library.GAME_STATE_SELECTING_SERVER] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\choose_zone.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\choose_zone.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_INSTALLING] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\installing.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\installing.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_DOWNLOADING] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\downloading.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\downloading.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[
                                            ierd_tgp.game_library.GAME_STATE_DOWNLOAD_PAUSED] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\download_paused.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\download_paused.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_UPDATING] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\updating.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\updating.png;Stretch;0;",
         };
        operate_area.menu_state_btn_background_[25] = {
            background = "ONEIMAGE:bottom_bar\\with_menu\\update_plugin_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\with_menu\\update_plugin_hover.png;Stretch;0;",
         };


        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_NORMAL] = {
            background = "ONEIMAGE:bottom_bar\\start.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\play_hover.tfc;Stretch;0",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_NEED_UPDATE] = {
            background = "ONEIMAGE:bottom_bar\\update_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\update_hover.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_UPDATE_FAIL] = {
            background = "ONEIMAGE:bottom_bar\\re_update_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\re_update_hover.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[
                                                ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED] = {
            background = "ONEIMAGE:bottom_bar\\download_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\download_hover.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_DOWNLOADED] = {
            background = "ONEIMAGE:bottom_bar\\install_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\install_hover.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[
                                                ierd_tgp.game_library.GAME_STATE_DOWNLOAD_FAIL] = {
            background = "ONEIMAGE:bottom_bar\\re_download_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\re_download_hover.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_BROKEN] = {
            background = "ONEIMAGE:bottom_bar\\re_download_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\re_download_hover.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_LAUNCHING] = {
            background = "ONEIMAGE:bottom_bar\\starting.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\starting.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_RUNNING] = {
            background = "ONEIMAGE:bottom_bar\\running.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\running.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[
                                        ierd_tgp.game_library.GAME_STATE_SERVER_UNAVAILABLE] = {
            background = "ONEIMAGE:bottom_bar\\mainting.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\mainting.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_UNINSTALLING] = {
            background = "ONEIMAGE:bottom_bar\\uninstalling.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\uninstalling.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[
                                            ierd_tgp.game_library.GAME_STATE_SELECTING_SERVER] = {
            background = "ONEIMAGE:bottom_bar\\choose_zone.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\choose_zone.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_INSTALLING] = {
            background = "ONEIMAGE:bottom_bar\\installing.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\installing.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_DOWNLOADING] = {
            background = "ONEIMAGE:bottom_bar\\downloading.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\downloading.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[
                                            ierd_tgp.game_library.GAME_STATE_DOWNLOAD_PAUSED] = {
            background = "ONEIMAGE:bottom_bar\\download_paused.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\download_paused.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[ierd_tgp.game_library.GAME_STATE_UPDATING] = {
            background = "ONEIMAGE:bottom_bar\\updating.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\updating.png;Stretch;0;",
         };
        operate_area.nomenu_state_btn_background_[25] = {
            background = "ONEIMAGE:bottom_bar\\update_plugin_normal.png;Stretch;0;",
            background_hover = "ONEIMAGE:bottom_bar\\update_plugin_hover.png;Stretch;0;",
         };
    end;

    refresh_operate_btn_status = function(game_state, enable, menu_bg, nomenu_bg)
        operate_area.inner_log(
                    string.format("refresh_operate_btn_status[%d, %s]", 
                    game_state, tostring(enable)));

        local operate_area_ctn_id = ui_utility.get_ctrl_id_by_path(
                                    wg_frame_bottom_view.bottom_operate_area_id_, "OperateAreaCtn");
        ui_utility.setproperty_by_id(operate_area_ctn_id, "Visible", "true");

        local disable = "false";
        if enable == false then
            disable = "true";
        end;
        ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuStateBtn", "Disable", disable);
        ui_utility.setproperty_by_path(operate_area_ctn_id, "NoMenuStateBtn", "Disable", disable);

        -- 带菜单样式
        local menu_normal_img = "";
        local menu_hover_img = "";
        local menu_press_img = "";
        if menu_bg ~= nil then
            menu_normal_img = menu_bg;
            menu_hover_img = menu_bg;
            menu_press_img = menu_bg;
        elseif operate_area.menu_state_btn_background_[game_state] ~= nil then
            menu_normal_img = operate_area.menu_state_btn_background_[game_state].background;
            menu_hover_img = operate_area.menu_state_btn_background_[game_state].background_hover;
            menu_press_img = operate_area.menu_state_btn_background_[game_state].background;
        end;
        ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuStateBtn", "Background", menu_normal_img);
        ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuStateBtn", "BackgroundHover", menu_hover_img);
        ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuStateBtn", "BackgroundPressed", menu_press_img);

        -- 无菜单样式
        local nomenu_normal_img ="";
        local nomenu_hover_img = "";
        local nomenu_press_img = "";
        if nomenu_bg ~= nil then
            nomenu_normal_img = nomenu_bg;
            nomenu_hover_img = nomenu_bg;
            nomenu_press_img = nomenu_bg;
        elseif operate_area.nomenu_state_btn_background_[game_state] ~= nil then
            nomenu_normal_img = 
                            operate_area.nomenu_state_btn_background_[game_state].background;
            nomenu_hover_img = 
                            operate_area.nomenu_state_btn_background_[game_state].background_hover;
            nomenu_press_img = 
                            operate_area.nomenu_state_btn_background_[game_state].background;
        end;
        ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                        "NoMenuStateBtn", "Background", nomenu_normal_img);
        ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                        "NoMenuStateBtn", "BackgroundHover", nomenu_hover_img);
        ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                        "NoMenuStateBtn", "BackgroundPressed", nomenu_press_img);
  
        if game_state == ierd_tgp.game_library.GAME_STATE_NORMAL then
            operate_area.refresh_normal_state_bg(game_state);
        else
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", "Disable", "false");
        end;

        -- 操作菜单样式
        if game_state == ierd_tgp.game_library.GAME_STATE_NORMAL then
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "Background", operate_area.menu_entry_bg.kNormalYello);
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "BackgroundHover", operate_area.menu_entry_bg.kHoverYello);
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "BackgroundPressed", operate_area.menu_entry_bg.kNormalYello);
        elseif game_state == ierd_tgp.game_library.GAME_STATE_NEED_UPDATE or
               game_state == ierd_tgp.game_library.GAME_STATE_UPDATE_FAIL then
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "Background", operate_area.menu_entry_bg.kNormalGreen);
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "BackgroundHover", operate_area.menu_entry_bg.kHoverGreen);
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "BackgroundPressed", operate_area.menu_entry_bg.kNormalGreen);
        elseif game_state == ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED or
               game_state == ierd_tgp.game_library.GAME_STATE_DOWNLOADED or  
               game_state == ierd_tgp.game_library.GAME_STATE_DOWNLOAD_FAIL or
               game_state == ierd_tgp.game_library.GAME_STATE_BROKEN then
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "Background", operate_area.menu_entry_bg.kNormalBlue);
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "BackgroundHover", operate_area.menu_entry_bg.kHoverBlue);
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                      "BackgroundPressed", operate_area.menu_entry_bg.kNormalBlue);
        else
                --[[ierd_tgp.game_library.GAME_STATE_LAUNCHING
                ierd_tgp.game_library.GAME_STATE_RUNNING
                ierd_tgp.game_library.GAME_STATE_SERVER_UNAVAILABLE
                ierd_tgp.game_library.GAME_STATE_UNINSTALLING
                ierd_tgp.game_library.GAME_STATE_SELECTING_SERVER
                ierd_tgp.game_library.GAME_STATE_INSTALLING
                ierd_tgp.game_library.GAME_STATE_UPDATE_PAUSED--]]
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                    "Background", operate_area.menu_entry_bg.kNormalYello);
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                    "BackgroundHover", operate_area.menu_entry_bg.kHoverYello);
            ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                    "BackgroundPressed", operate_area.menu_entry_bg.kNormalYello);
        end;

        operate_area.refresh_menu_entry_status();
    end;

    refresh_menu_entry_status = function()
        local menu_item_total, menu_item_status = operate_area.get_menu_item_total_count();
        
        local operate_area_ctn_id = ui_utility.get_ctrl_id_by_path(
                                    wg_frame_bottom_view.bottom_operate_area_id_, "OperateAreaCtn");
        if menu_item_total > 0 then
            ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuStateBtn", "Visible", "true");
            ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuBtn", "Visible", "true");
            ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "NoMenuStateBtn", "Visible", "false");
        else
            ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuStateBtn", "Visible", "false");
            ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuBtn", "Visible", "false");
            ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "NoMenuStateBtn", "Visible", "true");
        end;
    end;

    get_menu_item_total_count = function()
        local menu_item_total = 0;
        if wg_frame_bottom_view.game_and_plugin_state_tbl_ == nil or
           wg_frame_bottom_view.game_and_plugin_state_tbl_.game == nil or
           wg_frame_bottom_view.game_and_plugin_state_tbl_.game.game_id == nil then
            return menu_item_total;
        end;

        local game_id = wg_frame_bottom_view.game_and_plugin_state_tbl_.game.game_id;

        -- 关闭游戏
        operate_area.menu_item_status.exit_game = false;
        if wg_frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
           wg_frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and 
           wg_frame_bottom_view.game_and_plugin_state_tbl_.game.status == 
                                            ierd_tgp.game_library.GAME_STATE_RUNNING then
            menu_item_total = menu_item_total + 1;
            operate_area.menu_item_status.exit_game = true;
        end;

        -- 单号多开
        operate_area.menu_item_status.multi_zone = false;
        local base_info = banner_model.get_game_base_info(game_id);
        if wg_frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
           wg_frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and 
           wg_frame_bottom_view.game_and_plugin_state_tbl_.game.status == 
                                            ierd_tgp.game_library.GAME_STATE_RUNNING and
           base_info ~= nil and base_info.support_more_zone == true then
            menu_item_total = menu_item_total + 1;
            operate_area.menu_item_status.multi_zone = true;
        end

        -- 小号多开
        operate_area.menu_item_status.multi_account = false;
        if wg_frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
           wg_frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and 
           wg_frame_bottom_view.game_and_plugin_state_tbl_.game.status == 
                                            ierd_tgp.game_library.GAME_STATE_RUNNING and
           base_utility.support_mul_instances(game_id) then
            menu_item_total = menu_item_total + 1;
            operate_area.menu_item_status.multi_account = true;
        end;

        -- 云游戏
        operate_area.menu_item_status.cloud_game = false;
        local cloud_game_entry_status = operate_area.get_cloud_game_entry_status();
        if cloud_game_entry_status ~= nil and cloud_game_entry_status.visible == true then
            menu_item_total = menu_item_total + 1;
            operate_area.menu_item_status.cloud_game = true;
        end;

        -- 大区选择 
        operate_area.menu_item_status.server_info = false;
        local server_info_status = operate_area.get_server_info_status();
        if server_info_status ~= nil and server_info_status.visible == true then
            menu_item_total = menu_item_total + 1;
            operate_area.menu_item_status.server_info = true;
        end;

        return menu_item_total, operate_area.menu_item_status;
    end;

    get_tool_panel = function()
        local tool_panel = frame_bottom_view.get_cur_tool_panel();
        return tool_panel;
    end;

    get_server_info_status = function()
        return frame_bottom_view.get_server_info_status();
    end;

    get_cloud_game_entry_status = function()
        local tool_panel = operate_area.get_tool_panel();
        if tool_panel ~= nil then
            local cloud_game_entry_status = tool_panel.get_cloud_game_entry_status();
            return cloud_game_entry_status;
        end;
    end;
   
    on_operate_menu_btn_click = function(uilib, control_id, x, y)
        if wg_frame_bottom_view.game_and_plugin_state_tbl_.game == nil then 
            return 
        end
        local game_id = wg_frame_bottom_view.game_and_plugin_state_tbl_.game.game_id;

        local rc = nil;
        local control_ptr = ui_utility.get_ctrl_ptr_by_id(control_id);
        if control_ptr ~= nil then
            rc = control_ptr:GetRectEx(TRUE,TRUE);
        end
        local tbl_param = {};
        if rc ~= nil then
            tbl_param = { xoffset = rc.left, 
                          yoffset = rc.top, 
                          width = rc.right - rc.left, 
                          height = rc.bottom - rc.top, 
                          id = game_id };
        end
        local json_str = base_utility.table_to_json(tbl_param);
        operate_menue_control.open_operate_menue(json_str);
    end;

    on_right_btn_click = function()
        frame_bottom_view.on_right_btn_click();
    end;

    on_start_update_btn_hover = function()
        frame_bottom_view.on_start_update_btn_hover();
    end;

    on_start_update_btn_leave = function()
        frame_bottom_view.on_start_update_btn_leave();
    end;

    is_menu_state_btn_visible = function()
        local ptr = ui_utility.get_ctrl_ptr_by_path(
                     wg_frame_bottom_view.bottom_operate_area_id_, "OperateAreaCtn\\MenuStateBtn");
        if ptr ~= nil and ptr:IsVisible() == TRUE then
            return true;
        end
        return false;
    end;

    refresh_normal_state_bg = function(game_state) 
        -- 未勾选启动协议状态下
        if ierd_tgp.game_library.GAME_STATE_NORMAL == game_state then
            local operate_area_ctn_id = ui_utility.get_ctrl_id_by_path(
                                  wg_frame_bottom_view.bottom_operate_area_id_, "OperateAreaCtn");
            if false == frame_bottom_model.is_all_protocol_agree(
                                        wg_frame_bottom_view.game_id_) then
                local bk_img = "ONEIMAGE:bottom_bar\\with_menu\\play_gray.png?Stretch;0;";
                local nomenu_bk_img = "ONEIMAGE:bottom_bar\\play_gray.png?Stretch;0;";

                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "NoMenuStateBtn", "Background", nomenu_bk_img);
                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "NoMenuStateBtn", "BackgroundHover", nomenu_bk_img);
                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "NoMenuStateBtn", "BackgroundPressed", nomenu_bk_img);

                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuStateBtn", "Background", bk_img);
                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuStateBtn", "BackgroundHover", bk_img);
                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                                            "MenuStateBtn", "BackgroundPressed", bk_img);
        
                ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                          "Disable", "true");
            else
                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                          "NoMenuStateBtn", "Background", 
                          operate_area.nomenu_state_btn_background_[game_state].background);
                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                          "NoMenuStateBtn", "BackgroundHover",
                          operate_area.nomenu_state_btn_background_[game_state].background_hover);
                ui_utility.setproperty_by_path(operate_area_ctn_id, 
                          "NoMenuStateBtn", "BackgroundPressed", 
                          operate_area.nomenu_state_btn_background_[game_state].background);

                ui_utility.setproperty_by_path(operate_area_ctn_id, "MenuBtn", 
                                          "Disable", "false");
            end;
        end;
    end;
};

operate_area.init();
